<#import "/admin/_layout.html" as layout>
<@layout.header "卡券分配"></@layout.header>
<@layout.body>
    <div class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-left">
                        <li class="breadcrumb-item"><a href="#">卡券</a></li>
                        <li class="breadcrumb-item active">分配</li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
    <section class="content">
        <div class="container-fluid">
            <div class="card card-default">
                <form id="myForm" method="POST" action="/admin/coupon/doTake">
                    <input type="hidden" name="couponId" value="${(coupon.id)!}">
                    <div class="card-body">
                        <div class="form-group">
                            <label for="title">卡券名称</label>
                            <input type="text" name="title" class="form-control" readonly id="title" placeholder="" value="${(coupon.title)!}">
                        </div>
                        <div class="form-group">
                            <label for="title">类型</label>
                            <input type="text" name="type" class="form-control" readonly id="type" placeholder="" value="${(coupon.typeStr)!}">
                        </div>
                        <div class="form-group">
                            <label for="amount">优惠券金额</label>
                            <input type="number" name="amount" class="form-control" id="amount" readonly placeholder="" value="${(coupon.amount)!}">
                        </div>
                        <div class="form-group">
                            <label for="quota">优惠券数量</label>
                            <input type="number" name="quota" class="form-control" id="quota" readonly placeholder="" value="${(coupon.quota)!}">
                        </div>
                        <div class="form-group">
                            <label for="quota">分配用户ID</label>
                            <input type="text" name="userId" class="form-control" id="userId" placeholder="请输入用户ID" value="">
                        </div>
                    </div>
                    <div class="card-footer">
                        <button type="submit" class="btn btn-primary">提交</button>
                    </div>
                </form>
            </div>
        </div>
    </section>
</@layout.body>
<@layout.script>
    <script>
        $(function () {
            submitForm({
                userId: { required: true},
            },{
                userId: {required: "请输入指派用户id"},
            })
        });
    </script>
</@layout.script>